package com.itheima.util;

/***
 * ThreadLocal工具类
 * 1.声明ThreadLocal
 * 2.定义多个方法
 *      向ThreadLocal存入数据
 *      从ThreadLocal取出数据
 *      删除ThreadLocal中数据
 * */

public class UserHolder {
    //1、 声明ThreadLocal
    private static ThreadLocal<Integer> t1 = new ThreadLocal<>();

    //存入数据
    public static void set(Integer id){
        t1.set(id);
    }
    //取出数据
    public static Integer get(){
        return t1.get();
    }

    //删除
    public static void remove(){
        t1.remove();
    }

}
